package com.eliza.base.viewrouter

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.DateRange
import androidx.compose.material.icons.rounded.Delete
import androidx.compose.material.icons.rounded.Home
import androidx.compose.material.icons.rounded.ShoppingCart
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable
import androidx.navigation.navigation
import com.eliza.base.views.component.ComponentScreen
import com.eliza.base.views.database.DataBaseScreen
import com.eliza.base.views.device.DeviceScreen
import com.eliza.base.views.learn.LearnScreen
import com.eliza.library.ui.inter.IBaseRoute
import com.eliza.library.ui.inter.INavScreen

enum class NavRootScreenEnum(
    override val title: String,
    override val imageVector: ImageVector,
    override val content: @Composable (NavController) -> Unit
) : IBaseRoute {
    Learn("Learn", Icons.Rounded.Home, { LearnScreen(it) }),
    Component("Component", Icons.Rounded.ShoppingCart, { ComponentScreen(nav = it) }),
    Device("Device", Icons.Rounded.Delete, { DeviceScreen(it) }),
    DataBase("DataBase", Icons.Rounded.DateRange, { DataBaseScreen(it) }),
    ;

    companion object : INavScreen {
        override fun RegisterRoute(navController: NavHostController,nav: NavGraphBuilder) {
            nav.navigation(
                startDestination = DataBase.title,
                route = "NavRootScreenEnum"
            ) {
                NavRootScreenEnum.entries.forEach { route ->
                    // 显示添加导航参数 (参数列表)
                    composable(route.title) {
                        route.content(navController)
                    }
                }
            }
        }

    }
}




